<?php

namespace App\Modules\Health\Models;

use App\Models\Collect;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;

class HealthDiseaseDiscern extends Model
{
    use HasDateTimeFormatter;

    protected $table = 'health_disease_discern';

    protected $primaryKey = 'id';

    protected $fillable = [
        'class_id', // 分类id
        'name', // 名称
        'img', // 图片
        'text', // 病症鉴别与选穴
        'treat_text', // 调理建议
        'is_show', // 是否显示 1-是 0-否
        'audio_file', // 音频文件
        'video_file', // 视频文件
    ];

    public function class()
    {
        return $this->belongsTo(HealthDiseaseDiscernClass::class, 'class_id');
    }

    public function disease_discern()
    {
        return $this->morphTo(Collect::class, 'belong');
    }
}
